<template>
	<view class="page">
		<view class="my_padding">
			<view class="feed_back">
				<view class="co_items">
					<view class="co_tit">公司名</view>
					<input data-key="company" v-model="company" focus />
				</view>
				<view class="co_items">
					<view class="co_tit">联系人</view>
					<input data-key="name" v-model="name" />
				</view>
				<view class="co_items">
					<view class="co_tit">手机号</view>
					<input data-key="tele" v-model="tele" />
				</view>
				<view class="co_items">
					<view class="co_tit">邮箱</view>
					<input data-key="email" v-model="email" />
				</view>
				<view class="co_items">
					<view class="co_tit">备注</view>
					<input data-key="remark" v-model="remark" />
				</view>
				
			</view>
		</view>
		
		<view class="submit_order" @click="submitOrder">完成</view>
		
		<uni-popup ref="popupDialog" type="dialog">
			<uni-popup-dialog type="ok" :content="message" :show-cancel-button="false"
				@confirm="dialogConfirm"></uni-popup-dialog>
		</uni-popup>
	</view>
</template>

<script>
	import tabBar from '@/components/tabBar/tabBar.vue'
	import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
	export default {
		components: {
			tabBar,
			uniPopupDialog
		},
		data() {
			return {
				company: '',
				name: '',
				userinfo: [],
				tele: '',
				email: '',
				ifOnShow: false,
				remark: '',
				message: "",
				showPopu: false
			};
		},

		onLoad: function(option) {
			 
		},
		methods: {

			navToUrl: function(url) {
				return uni.navigateTo({
					url: url
				});
			},
			imageError: function(e) {
				this.avatar = '/static/icon_avatar.png';
			},
			submitOrder: function(){
				if(this.company == ''){
					uni.showToast({
						title:"公司名称不能为空",
						icon:"none"
					})
					return;
				}
				if(this.name == ''){
					uni.showToast({
						title:"联系人不能为空",
						icon:"none"
					})
					return;
				}
				if(this.tele == ''){
					uni.showToast({
						title:"电话不能为空",
						icon:"none"
					})
					return;
				}
				if(this.email == ''){
					uni.showToast({
						title:"邮箱不能为空",
						icon:"none"
					})
					return;
				}											
					var info = uni.getStorageSync("userinfo");
					let timestamp = this.helper.now();
					let sign = this.helper.setSign(['company='+this.company,'name='+this.name,'tele='+this.tele,'email='+this.email,'remark='+this.remark,'token='+info.token,'timestamp='+timestamp]);
					this.helper.req({
						api:"doCooperation",
						timestamp:timestamp,
						data:{
							token:info.token,
							company: this.company,
							name:this.name, 
							tele:this.tele,
							email:this.email,
							remark:this.remark
							},
						header:{sign:sign},
						method:'POST',
					}).then(res=>{
						
						uni.showModal({
							title: "提示",
							content: res.data.message,
							showCancel:false,
							confirmText: "确定",
							success:function(res){
								uni.redirectTo({
									url: '/pages/user/person'
								})
							}
						})
					})
			}
		},
	};
</script>

<style lang="scss">
	page {
		font-size: 3.46667vw;
		min-width: 325px;
		color: #56595d;
		background-color: #ddeafd;
		padding-bottom: 16px;
	}
	
	.my_padding {
		/* padding: 50px 15px 16px 15px; */
		/* padding: 12px; */
		/* display: flex; */
		background-color: #EEE;
		height: 800px;
		// background-image: url('@/static/images/bg_new_guide.png');
		// background-size: 100% 150px;
		// background-repeat: no-repeat;
		// background-size: cover;
	}
	.feed_back textarea{
		width: 96vw;
		height: 50vw;
		margin: 2vw;
		background: #FFF;
		padding: 3vw;
	}
	
	.co_items{
		width: 100vw;
		height: 28vw;
		padding: 6vw 6vw 0;
	}
	.co_items .co_tit{
		line-height: 40px;
		font-size: 14px;
		color: #666;
	}
	.co_items input{
		height: 50px;
		line-height: 24px;
		padding: 2vw 0;
		border-bottom: 1px solid #AAA;
		font-size: 16px;
		color:#666;
	}
	
	.submit_order{
		width: 96%;
		padding: 12px;
		background-color: #fe8f27;
		color: #fff;
		font-size: 18px;
		text-align: center;
		border-radius: 6px;
		position: fixed;
		bottom: 10px;
		left: 2%;
	}

</style>
<!-- index -->
<style lang="scss" scoped>
	.tab-bar-footer {
		background-color: #fff;
		border-radius: 3.2vw;
		// margin: 3.33333vw auto 0;
		    margin-bottom: 60px;
			padding: 16px 0;
		width: 94vw;
		box-shadow: 0 0 25px rgba(0, 0, 0, 0.2);
	}

	.tab-bar {
		padding: 30px 0;
		background-color: #fff;
		border-radius: 3.2vw;
		// margin: 3.33333vw auto 0;
		width: 94vw;
		box-shadow: 0 0 25px rgba(0, 0, 0, 0.2);

	}
</style>
<!-- uni-grid -->
<style lang="scss" scoped>
	.image {
		width: 25px;
		height: 25px;
	}

	.text {
		margin-top: 10upx;
	}

	.example-body {
		/* #ifndef APP-NVUE */
		// display: block;
		/* #endif */
	}

	.swiper {
		height: 420px;
	}

	/* #ifdef H5 */
	@media screen and (min-width: 768px) and (max-width: 1425px) {
		.swiper {
			height: 630px;
		}
	}

	@media screen and (min-width: 1425px) {
		.swiper {
			height: 830px;
		}
	}

	/* #endif */
</style>